﻿using System.Collections.Generic;
using Framework;

namespace AccountModule
{
    public class AccountManager : Singleton<AccountManager>
    {
        private Dictionary<string, Account> _mapName2account = new Dictionary<string, Account>();

        private string _accountName;

        public string accountName
        {
            get { return _accountName; }
            set { _accountName = value; }
        }
        
        public AccountManager()
        {
            AddAccount(new Account("叶", 851, 162, 55, Gender.Female, 920));
        }

        public void AddAccount(Account account)
        {
            _mapName2account.Add(account.name, account);
        }

        public Account GetAccount(string name)
        {
            Account account;
            _mapName2account.TryGetValue(name, out account);
            return account;
        }

        public Account GetCurrentAccount()
        {
            return _mapName2account[accountName];
        }
    }
}